<?php
$ch=curl_init();
$url="https://www.17k.com/all";
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);

$data=curl_exec($ch);
$res='#<tr class="bg0">.*<td class="td1">(.*)</td>.*<td class="td2">.*<a href=".*" target=".*">(.*)</a>.*</td>.*<td class="td3">.*<span>.*<a class="jt" rel = ".*"  href=".*" target=".*" title="">(.*)</a>.*</span>.*</td>.*</tr>#isU';

preg_match_all($res,$data,$reld);
$g_name=$reld[1];
$g_desc=$reld[2];
$g_autho=$reld[3];

print_r($g_name);
print_r($g_desc);
print_r($g_autho);

$sql="insert into games(g_id,g_name,g_desc,g_autho) VALUES";
foreach($g_name as $k=>$v)
{
    $sql.="(null,$v,'$g_desc[$k]','$g_autho[$k]'),";
}
$sql=substr($sql,0,-1);
echo $sql;
$dbh = new PDO('mysql:host=127.0.0.1;dbname=1705php', 'root', 'root');
echo $dbh->exec($sql);
?>